﻿using System;
using System.Runtime.CompilerServices;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Animation;
using LiveCharts;
using LiveCharts.Charts;
using LiveCharts.Definitions.Points;
using LiveCharts.Dtos;
using LiveCharts.Wpf;
using LiveCharts.Wpf.Points;

internal class Class6 : PointView, IChartPointView, IRectanglePointView
{
	[CompilerGenerated]
	public Class3 method_0()
	{
		return this.class3_0;
	}

	[CompilerGenerated]
	public void method_1(Class3 class3_1)
	{
		this.class3_0 = class3_1;
	}

 
	public CoreRectangle Data { get; set; }

 
	public double ZeroReference { get; set; }

	[CompilerGenerated]
	public BarLabelPosition method_2()
	{
		return this.barLabelPosition_0;
	}

	[CompilerGenerated]
	public void method_3(BarLabelPosition barLabelPosition_1)
	{
		this.barLabelPosition_0 = barLabelPosition_1;
	}

	[CompilerGenerated]
	public RotateTransform method_4()
	{
		return this.rotateTransform_0;
	}

	[CompilerGenerated]
	public void method_5(RotateTransform rotateTransform_1)
	{
		this.rotateTransform_0 = rotateTransform_1;
	}

	public override void DrawOrMove(ChartPoint previousDrawn, ChartPoint current, int index, ChartCore chart)
	{
		Class6.Class7 @class = new Class6.Class7();
		@class.class6_0 = this;
		@class.chartCore_0 = chart;
		base.ValidArea = new CoreRectangle(this.Data.Left, this.Data.Top, this.Data.Width, this.Data.Height);
		if (base.IsNew)
		{
			this.method_0().point=(new Point(this.Data.Left, this.ZeroReference));
			this.method_0().width=(this.Data.Width);
			this.method_0().height=(0.0);
			this.method_0().method_7(false, TimeSpan.Zero);
			this.pathGeometry_0 = (PathGeometry)((GColumnSeries)current.SeriesView).ShapesStroke.Path_0.Data;
			this.pathGeometry_0.Figures.Add(this.method_0().pathFigure_0 );
			if (base.DataLabel != null)
			{
				Canvas.SetTop(base.DataLabel, this.ZeroReference);
				Canvas.SetLeft(base.DataLabel, current.ChartLocation.X);
			}
		}
		Func<double> func = new Func<double>(@class.method_0);
		Func<double> func2 = new Func<double>(@class.method_1);
		this.method_0().width=(this.Data.Width);
		this.method_0().height=(this.Data.Height);
		this.method_0().point=(new Point(this.Data.Left, this.Data.Top));
		if (@class.chartCore_0.View.DisableAnimations)
		{
			this.method_0().method_7(false, TimeSpan.Zero);
			if (base.DataLabel != null)
			{
				base.DataLabel.UpdateLayout();
				Canvas.SetTop(base.DataLabel, func());
				Canvas.SetLeft(base.DataLabel, func2());
			}
			return;
		}
		TimeSpan animationsSpeed = @class.chartCore_0.View.AnimationsSpeed;
		if (base.DataLabel != null)
		{
			base.DataLabel.UpdateLayout();
			base.DataLabel.BeginAnimation(Canvas.LeftProperty, new DoubleAnimation(func2(), animationsSpeed));
			base.DataLabel.BeginAnimation(Canvas.TopProperty, new DoubleAnimation(func(), animationsSpeed));
		}
		this.method_0().method_7(true, animationsSpeed);
	}

	public override void RemoveFromView(ChartCore chart)
	{
		chart.View.RemoveFromDrawMargin(base.DataLabel);
		if (this.pathGeometry_0 != null)
		{
			this.pathGeometry_0.Figures.Remove(this.method_0().pathFigure_0 );
		}
	}

	public override void OnHover(ChartPoint point)
	{
	}

	public override void OnHoverLeave(ChartPoint point)
	{
	}

	[CompilerGenerated]
	private Class3 class3_0;

	[CompilerGenerated]
	private CoreRectangle coreRectangle_0;

	[CompilerGenerated]
	private double double_0;

	[CompilerGenerated]
	private BarLabelPosition barLabelPosition_0;

	[CompilerGenerated]
	private RotateTransform rotateTransform_0;

	private PathGeometry pathGeometry_0;

	[CompilerGenerated]
	private sealed class Class7
	{
		internal double method_0()
		{
			double num;
			if (this.class6_0.method_2() == BarLabelPosition.Merged)
			{
				if (this.class6_0.method_4() == null)
				{
					this.class6_0.method_5(new RotateTransform(270.0));
				}
				this.class6_0.DataLabel.RenderTransform = this.class6_0.method_4();
				num = this.class6_0.Data.Top + this.class6_0.Data.Height / 2.0 + this.class6_0.DataLabel.ActualWidth * 0.5;
			}
			else if (this.class6_0.ZeroReference > this.class6_0.Data.Top)
			{
				num = this.class6_0.Data.Top - this.class6_0.DataLabel.ActualHeight;
				if (num < 0.0)
				{
					num = this.class6_0.Data.Top;
				}
			}
			else
			{
				num = this.class6_0.Data.Top + this.class6_0.Data.Height;
				if (num + this.class6_0.DataLabel.ActualHeight > this.chartCore_0.DrawMargin.Height)
				{
					num -= this.class6_0.DataLabel.ActualHeight;
				}
			}
			return num;
		}

		internal double method_1()
		{
			double num;
			if (this.class6_0.method_2() == BarLabelPosition.Merged)
			{
				num = this.class6_0.Data.Left + this.class6_0.Data.Width / 2.0 - this.class6_0.DataLabel.ActualHeight / 2.0;
			}
			else
			{
				num = this.class6_0.Data.Left + this.class6_0.Data.Width / 2.0 - this.class6_0.DataLabel.ActualWidth / 2.0;
				if (num < 0.0)
				{
					num = 2.0;
				}
				if (num + this.class6_0.DataLabel.ActualWidth > this.chartCore_0.DrawMargin.Width)
				{
					num -= num + this.class6_0.DataLabel.ActualWidth - this.chartCore_0.DrawMargin.Width + 2.0;
				}
			}
			return num;
		}

		public Class6 class6_0;

		public ChartCore chartCore_0;
	}
}
